import 'package:flutter/material.dart';
// import 'package:fluttertoast/fluttertoast.dart';
// import 'package:oktoast/oktoast.dart';

class ButtonPage extends StatefulWidget {
  const ButtonPage({Key? key}) : super(key: key);

  @override
  _ButtonPageState createState() => _ButtonPageState();
}

class _ButtonPageState extends State<ButtonPage> {
  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        centerTitle: true,
        title: Text( widget.runtimeType.toString()),
        leading: const Text("这里设置了，就没有左滑"),
      ),
      body: ListView(
        children: [
          const SizedBox(
            height: 10,
          ),
          const BackButtonIcon(),
          const SizedBox(
            height: 10,
          ),
          const BackButton(),
          AppBar(
            leading: InkWell(
              child: const BackButtonIcon(),
              onTap: () {
                Navigator.push(context, MaterialPageRoute(builder: (context) {
                  return Scaffold(
                    appBar: AppBar(
                      title: const Text('老孟 1'),
                    ),
                  );
                }));
              },
              radius: 10,
            ),
            actions: [
              IconButton(
                  onPressed: () {
                    // showToastWidget(Text("标题"));
                    // showToast("dddddd");
                    // OKToast(child: Text("标题"));
                    // Fluttertoast.showToast(msg: "ddd");
                  },
                  icon: const Icon(Icons.add)),
            ],
          ),
          BackButton(
            onPressed: () {
              // automaticallyImplyLeading: false, 使其路由跳转时，没有返回按钮
              Navigator.push(context, MaterialPageRoute(builder: (context) {
                return Scaffold(
                  appBar: AppBar(
                    automaticallyImplyLeading: true,
                    title: const Text('老孟 1'),
                  ),
                );
              }));
            },
          ),
          Flex(
            direction: Axis.horizontal,
            children: const <Widget>[
              Expanded(
                flex: 1,
                child: Align(
                  child: Text("data"),
                ),
              ),
              Expanded(
                flex: 2,
                child: Align(
                  child: Text("data"),
                ),
              ),
            ],
          ),
          // Icon(OMIcons.home, color: Colors.white)
          //   .padding(all: 10)
          //   .decorated(color: Color(0xff7AC1E7), shape: BoxShape.circle)
          //   .padding(all: 15)
          //   .decorated(color: Color(0xffE8F2F7), shape: BoxShape.circle)
          //   .padding(all: 20)
          //   .card(
          //     elevation: 10,
          //     shape: RoundedRectangleBorder(
          //       borderRadius: BorderRadius.circular(20),
          //     ),
          //   )
          //   .alignment(Alignment.center)
          //   .backgroundColor(Color(0xffEBECF1)),
        ],
      ),
      drawer: const Drawer(),
    );
  }
}
